<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>
    <div id="app">
        <father></father>
    </div>
    <script src="./node_modules/vue/dist/vue.js"></script>
    <script>
        let son = {
            props: ['m'],
            data() {
                return {
                   
                }
            },


            template: "<div>Son---{{m}} <button @click='getmore'>获取更多</button></div>",
            methods: {
                getmore() {
                    // 组件实例对象 -- 父组件
                    console.log(this.$parent)
                    this.$parent.money += 200
                }
            }
        }

        let father = {
            components: {
                son
            },
            data() {
                return {
                    money: 100
                }
            },
            template: "<div>father<son :m='money'></son></div>",
            
        }


        const app = new Vue({
            el: "#app",
            components: {
                father
            },
            data() {
                return {}
            }
        })
    </script>
</body>

</html>